<%--
/**
* Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>


<%@page import="com.hotel.test.service.HotelLocalServiceUtil"%>
<%@page import="com.hotel.test.service.persistence.LocalUtil"%>
<%@page import="com.hotel.test.service.LocalLocalServiceUtil"%>
<%@include file="/html/init.jsp" %>



<%
String localId = request.getParameter("localId");
		String url = (String) request.getAttribute("url");
List<Hotel> hotels;
if(localId!=null)
{
	hotels= HotelLocalServiceUtil.getByLocalId(Long.parseLong(localId));
	%>
		<h1>Cac Khach San Gan Dia Diem <%=LocalLocalServiceUtil.getLocal(Long.parseLong(localId)).getLocalName() %></h1>
		
		
		
	
		
	<%
}
else
{
	hotels = HotelLocalServiceUtil.getAll();
	%>
		<h1>Danh Sach Tat Ca Cac Khach San</h1>
		
	<%
	}



%>

<portlet:actionURL var="switchActionURL" name="switchAction">
	<portlet:param name="redirectTo" value="<%=url %>"></portlet:param>
</portlet:actionURL>

<form action="<%=switchActionURL%>" method="post">
	<input type="submit"  name="switchAction" value="add Hotel"/>
	<input type="submit"  name="switchAction" value="add RoomType"/>
	
</form>

 <liferay-ui:search-container emptyResultsMessage="there-are-no-products" delta="8">
<liferay-ui:search-container-results>
<%


results = ListUtil.subList(hotels, searchContainer.getStart(), searchContainer.getEnd());
total = hotels.size();
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total);
%>
</liferay-ui:search-container-results>
<liferay-ui:search-container-row
className="com.hotel.test.model.Hotel"
keyProperty="hotelId" modelVar="hotel">
<liferay-ui:search-container-column-text
name="hotelId"
property="hotelId"
/>
<portlet:actionURL name="hotelDetail" var="hotelDetailURL">
	<portlet:param name="hotelId" value="<%=String.valueOf(hotel.getHotelId()) %>"></portlet:param>
	<portlet:param name="redirectTo" value="<%=url %>"></portlet:param>
</portlet:actionURL>

<liferay-ui:search-container-column-text  href="${hotelDetailURL}"  name="name" property="hotelName"/>
<liferay-ui:search-container-column-jsp
path="/html/admin/hotel_action.jsp"
align="right"
/>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container> 

